﻿<Window x:Class="WpfMonitor.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:WpfMonitor"
        Title="链接采集监控程序" Height="600" Width="1000" WindowStartupLocation="CenterScreen" Icon="Images/1362660410_Matrix.png">
    <Window.Resources>
        <local:DataTemplateSelectorBase x:Key="ImageSelector"></local:DataTemplateSelectorBase>
        <DataTemplate x:Key="ReportTypeInfomationImage" x:Name="mReportTypeInfoImage">            
            <Image Width="16" Height="16" Source="Images\info.png" />
            <!-- Embedded -->
        </DataTemplate>
        <DataTemplate x:Key="ReportTypeErrorImage" x:Name="mReportTypeErrorImage">
            <Image Width="16" Height="16" Source="Images\error.png" />
            <!-- Embedded -->
        </DataTemplate>
        <Style TargetType="{x:Type DataGridColumnHeader}">            
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="FontSize" Value="14px"/>
            <Setter Property="FontWeight" Value="Bold"/>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition ></RowDefinition>
            <RowDefinition Height="40"></RowDefinition>
        </Grid.RowDefinitions>
        <DataGrid SelectionMode="Single" SelectionUnit="FullRow" Name="grid" ItemsSource="{Binding}" AutoGenerateColumns="False" AllowDrop="False" CanUserAddRows="False" CanUserDeleteRows="False" IsReadOnly="True">
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="" Width="40" CellTemplateSelector="{StaticResource ImageSelector}" >
                    
                </DataGridTemplateColumn>                
                <DataGridTextColumn Header="信息" Width="200" Binding="{Binding Message}" ></DataGridTextColumn>
                <DataGridTextColumn Header="时间" Width="150" Binding="{Binding CrawledTime, StringFormat={}{0:yyyy/MM/dd hh:mm:ss}}" ></DataGridTextColumn>
                <DataGridHyperlinkColumn Header="链接" Width="*" Binding="{Binding Url}"></DataGridHyperlinkColumn>
            </DataGrid.Columns>
        </DataGrid>
        <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
            <Button  Height="30" Content="启动" MaxWidth="60" MinWidth="60" Margin="0,0,10,0" Name="Start" Click="Start_Click"/>
            <Button  Height="30" Content="停止" MaxWidth="60" MinWidth="60" Margin="10,0,10,0" Name="Stop" Click="Stop_Click"/>
            <Button  Height="30" Content="清空" MaxWidth="60" MinWidth="60" Margin="10,0,0,0" Name="Clear" Click="Clear_Click"/>
        </StackPanel>
    </Grid>
</Window>
